#!/bin/sh
# This script permits calling ganttproject from the /bin directly
# rather than from /opt/ganttproject.
# It supports white spaces in file names.
# Chris Abela <chris.abela@maltats.com>

# Usage: if /bin is in your $PATH, then:
# $ ganttproject "World Domination Project.gan"
# or simply: $ ganttproject

[ $# -gt 1 ] && echo "Sorry! - Only one argument is allowed" && exit
if [ $# -eq 1 ]
then
	DIRNAME=`dirname "$1"`
	case "$DIRNAME" in
		.) DIRNAME="$PWD" ;;
		/) unset DIRNAME ;;
	esac
	BASENAME=`basename "$1"`
	cd /opt/ganttproject
	./ganttproject.sh "$DIRNAME/$BASENAME"
else
	cd /opt/ganttproject
	./ganttproject.sh 
fi
